<template>
  <el-container>
    <el-header>
      <div>
        <img src="../assets/logo.png" height="20" alt="">
        <span>进销存后台管理系统</span>
        <p>{{username}}</p>
      </div>
    </el-header>
    <el-container>
      <el-aside>
        <el-menu
          default-active="/saleTable"
          class="el-menu-vertical-demo"
          @select="handleSelect"
          router
        >
          <el-submenu index="/home">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>导航一</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/saleTable">查看销售</el-menu-item>
              <el-menu-item index="/addSale">添加销售</el-menu-item>
              <el-menu-item index="/showQuantity">查看库存</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>导航二</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="2-1">选项3</el-menu-item>
              <el-menu-item index="2-2">选项4</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
    export default {
        name: "",
      data(){
          return {
            username:localStorage.getItem("realName"),
          }
      },
      methods: {
        handleSelect(index,indexPath){
          console.log(index);
          console.log(indexPath);
        }
      }
    }
</script>

<style scoped>
  .home-container {
    height: 100%;
  }
  .el-header {
    background-color: #373d41;
    display: flex;
    justify-content: space-between;
    padding-left: 0;
    align-items: center;
    color: #fff;
    font-size: 20px;
  > div {
      display: flex;
      align-items: center;
      span {
        margin-left: 15px;
      }
    }
  }

  .el-aside {
    background-color: #333744;
    .el-menu {
      border-right: none;
    }
  }

  .el-main {
    background-color: #eaedf1;
  }

  .iconfont {
    margin-right: 10px;
  }

  .toggle-button {
    background-color: #4a5064;
    font-size: 10px;
    line-height: 24px;
    color: #fff;
    text-align: center;
    letter-spacing: 0.2em;
    cursor: pointer;
  }
</style>
